FROM registry.cn-hangzhou.aliyuncs.com/xiaoyilin/cmake:3.31.10
LABEL author=xiaoyilin
LABEL email=406735078@qq.com
ENV TZ=Asia/Shanghai
ENV JAVA_HOME=/usr/local/jre1.8.0_471
ENV PATH=$JAVA_HOME/bin:$PATH
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
apt-get -y update && apt-get -y install unzip build-essential libpcap-dev  libssl-dev libsqlite3-dev doxygen
ADD sqlite-amalgamation-3500400.zip v1.6.1.tar.gz jre-8u461-linux-x64.tar.gz /usr/local/
WORKDIR /usr/local/libiec61850-1.6.1
RUN unzip  /usr/local/sqlite-amalgamation-3500400.zip -d /usr/local/ && \
cp  /usr/local/sqlite-amalgamation-3500400/sqlite3.c third_party/sqlite/   && \
cp  /usr/local/sqlite-amalgamation-3500400/sqlite3ext.h  third_party/sqlite/   && \
cp  /usr/local/sqlite-amalgamation-3500400/sqlite3.h third_party/sqlite/  && \
rm -rf /usr/local/sqlite-amalgamation-3500400  /usr/local/sqlite-amalgamation-3500400.zip && \
apt-get -y purge unzip  && \
apt-get autoremove  && \
rm -rf /var/lib/apt/lists/* && \
# 生成构建系统
cmake -G "Unix Makefiles" -S . -B build  -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DCMAKE_C_COMPILER=/usr/bin/cc  && \
#  编译阶段
cmake --build build && \
# 多线程编译
# cmake --build build -j8 && \
# 安装阶段
cmake --install build


# docker build  -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/iec61850:1.6.1 .
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/iec61850:1.6.1
# docker run --rm -it registry.cn-hangzhou.aliyuncs.com/xiaoyilin/iec61850:1.6.1 bash
# cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DCMAKE_C_COMPILER=/usr/bin/cc ..

# https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe
# https://www.doxygen.nl/download.html
# https://github.com/doxygen/doxygen/releases
# D:\wsl\cd\libiec61850-1.6.1
# cmake -G "Visual Studio 17 2022" -S . -B build  -A x64
# D:\wsl\cd\libiec61850-1.6.1\build\src\Release\iec61850.dll
# D:\wsl\cd\libiec61850-1.6.1\build\src\Release\iec61850.lib
# cmake --build build -j4
# cmake --install build

# https://libiec61850.com/documentation/building-the-library/
# https://github.com/mz-automation/libiec61850
# https://libiec61850.com/documentation/iec-61850-server-tutorial/
# https://libiec61850.com/documentation/control-tutorial/
# docker cp 56f8a24979b6:/usr/local/libiec61850-1.6.1/build/src/libiec61850.so.1.6.1 /mnt/d/wsl/